<?php
extract(array(
	'image_width' => 140,
	'image_height' => 140,
), EXTR_SKIP);
?>
<div id="upload_avatar">
	<div class="user-avatar">

		<div class="current-avatar">
			<div class="current-avatar-img">
				<div id="preview">
					<?php $this->renderPartial('//common/image', array('pair' => $user->avatar, 'object_type' => 'user', 'no_link' => true, 'width' => $image_width, 'height' => $image_height)); ?>
				</div>
			</div>
			
			<a class="button button2 upload-button" name="upload_avatar"><i>+</i> Upload Mới</a>
			<div style="font-size: 10px; color: #5a5a5a;">
				<br /><em>- Kích thước file tối đa là 4MB</em>
				<br /><em>- Hỗ trợ: PNG, JPG, JPEG, GIF</em>
			</div>
		</div>
		
		<div class="new-avatar">
			<form class="cm-ajax" action="<?php echo $this->createUrl('/user/uploadAvatar') ?>" method="post"></form>
		</div>

	</div>
	
	<script type="text/javascript">
		js_init_upload_avatar($('.upload-button').get(0), '<?php echo $this->createUrl('/user/uploadAvatar') ?>', '.new-avatar');
	</script>
<!--upload_avatar--></div>